<template>
	<div style="display: flex; align-items: center">
		<div style="margin-right: 10px; width: 60%">{{ name || '空' }}</div>
		<el-input-number v-model="inputValue" :min="0" :max="max || 65535"></el-input-number>
	</div>
</template>

<script setup>
import { onMounted } from 'vue'

const props = defineProps(['name', 'modelValue', 'max'])
const emit = defineEmits(['update:modelValue'])
const inputValue = computed({
	get: () => {
		if (props.modelValue == null) {
			emit('update:modelValue', 0)
		}
		return props.modelValue
	}, // 将null显示为0
	set: (val) => {
		emit('update:modelValue', val)
	}
})
</script>
